package com.es.disped.dao.mapper;

import com.es.disped.dao.model.Permission;
import com.es.disped.dao.model.PermissionExample;
import java.util.List;

import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

//@CacheNamespace(implementation=(com.es.disped.dao.cache.RedisCache.class),size=512,flushInterval=60000)
public interface PermissionMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @SelectProvider(type=PermissionSqlProvider.class, method="countByExample")
    long countByExample(PermissionExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @DeleteProvider(type=PermissionSqlProvider.class, method="deleteByExample")
    int deleteByExample(PermissionExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @Delete({
        "delete from permission",
        "where permission_id = #{permissionId,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(String permissionId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @Insert({
        "insert into permission (permission_id, permission_parent_id, ",
        "permission_name, permission_code, ",
        "permission_index, permission_type, ",
        "permission_level, permission_valid)",
        "values (#{permissionId,jdbcType=CHAR}, #{permissionParentId,jdbcType=CHAR}, ",
        "#{permissionName,jdbcType=VARCHAR}, #{permissionCode,jdbcType=VARCHAR}, ",
        "#{permissionIndex,jdbcType=INTEGER}, #{permissionType,jdbcType=VARCHAR}, ",
        "#{permissionLevel,jdbcType=INTEGER}, #{permissionValid,jdbcType=INTEGER})"
    })
    int insert(Permission record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @InsertProvider(type=PermissionSqlProvider.class, method="insertSelective")
    int insertSelective(Permission record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @SelectProvider(type=PermissionSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="permission_id", property="permissionId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="permission_parent_id", property="permissionParentId", jdbcType=JdbcType.CHAR),
        @Result(column="permission_name", property="permissionName", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_code", property="permissionCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_index", property="permissionIndex", jdbcType=JdbcType.INTEGER),
        @Result(column="permission_type", property="permissionType", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_level", property="permissionLevel", jdbcType=JdbcType.INTEGER),
        @Result(column="permission_valid", property="permissionValid", jdbcType=JdbcType.INTEGER)
    })
    List<Permission> selectByExample(PermissionExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @Select({
        "select",
        "permission_id, permission_parent_id, permission_name, permission_code, permission_index, ",
        "permission_type, permission_level, permission_valid",
        "from permission",
        "where permission_id = #{permissionId,jdbcType=CHAR}"
    })
    @Results({
        @Result(column="permission_id", property="permissionId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="permission_parent_id", property="permissionParentId", jdbcType=JdbcType.CHAR),
        @Result(column="permission_name", property="permissionName", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_code", property="permissionCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_index", property="permissionIndex", jdbcType=JdbcType.INTEGER),
        @Result(column="permission_type", property="permissionType", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_level", property="permissionLevel", jdbcType=JdbcType.INTEGER),
        @Result(column="permission_valid", property="permissionValid", jdbcType=JdbcType.INTEGER)
    })
    Permission selectByPrimaryKey(String permissionId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @UpdateProvider(type=PermissionSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Permission record, @Param("example") PermissionExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @UpdateProvider(type=PermissionSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Permission record, @Param("example") PermissionExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @UpdateProvider(type=PermissionSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Permission record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Sun Jun 30 15:19:20 CST 2019
     */
    @Update({
        "update permission",
        "set permission_parent_id = #{permissionParentId,jdbcType=CHAR},",
          "permission_name = #{permissionName,jdbcType=VARCHAR},",
          "permission_code = #{permissionCode,jdbcType=VARCHAR},",
          "permission_index = #{permissionIndex,jdbcType=INTEGER},",
          "permission_type = #{permissionType,jdbcType=VARCHAR},",
          "permission_level = #{permissionLevel,jdbcType=INTEGER},",
          "permission_valid = #{permissionValid,jdbcType=INTEGER}",
        "where permission_id = #{permissionId,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(Permission record);
}